/**
 * 
 */
package fr.toto.menuitem;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;

import com.kokotchy.betaSeriesAPI.model.Episode;
import com.kokotchy.betaSeriesAPI.model.Show;

import fr.toto.constantes.Constantes;
import fr.toto.constantes.Query;
import fr.toto.triseries.ExecQuery;
import fr.toto.triseries.SeriesSet;

/**
 * @author tshepo
 * 
 */
public class ArchiveSerieMenuItem extends JMenuItem implements Constantes {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1364368653919711530L;
	Episode ep = null;

	/**
	 * 
	 */
	public ArchiveSerieMenuItem(Episode e) {
		super(MESSAGES.getString("ArchiveMI"));
		this.ep = e;

		this.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				Show s = SeriesSet.findShow(ep);
				s.setArchived(true);
				(new Thread(new ExecQuery(s, Query.ARCHIVE))).start();
			}
		});

	}

}
